# -*- coding:utf-8 -*-
__author__ = 'gin.chen'


##计算

def calculate_less_coin(price):
    if price < 0 or price > 1024:
        return "error"
    count1, count2, count3, count4 = 0, 0, 0, 0
    z = 1024 - price
    while z >= 64:
        z -= 64
        count1 += 1

    while z >= 16:
        z -= 16
        count2 += 1
    while z >= 4:
        z -= 4
        count3 += 1
    while z >= 1:
        count4 += 1
    return count1 + count2 + count3 + count4


if __name__ == '__main__':
    price = input()
    print(calculate_less_coin(int(price)))
